home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / winterp-1.13 / examples / interact.lsp < prev    next >
Encoding:
Lisp/Scheme  |  1991-10-06  |  3.8 KB  |  109 lines

  1. ; -*-Lisp-*-
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. ;
  4. ; File:         interact.lsp
  5. ; RCS:          $Header: interact.lsp,v 1.4 91/10/05 18:19:53 mayer Exp $
  6. ; Description:  Play around with interactive features of winterp. 
  7. ;               GET_MOUSED_WIDGET allows you to send a message to any widget
  8. ;               that you can see. Thus you can interactively change your
  9. ;               interfaces' appearance or functionality without having to
  10. ;               remember the name  of the desired widget. Note that this'll
  11. ;               even work on big composite widgets that create other widgets
  12. ;               internally....
  13. ; Author:       Niels Mayer, HPLabs
  14. ; Created:      Sat Nov 25 01:36:28 1989
  15. ; Modified:     Sat Oct  5 18:18:12 1991 (Niels Mayer) mayer@hplnpm
  16. ; Language:     Lisp
  17. ; Package:      N/A
  18. ; Status:       X11r5 contrib tape release
  19. ;
  20. ; WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  21. ; XLISP version 2.1, Copyright (c) 1989, by David Betz.
  22. ;
  23. ; Permission to use, copy, modify, distribute, and sell this software and its
  24. ; documentation for any purpose is hereby granted without fee, provided that
  25. ; the above copyright notice appear in all copies and that both that
  26. ; copyright notice and this permission notice appear in supporting
  27. ; documentation, and that the name of Hewlett-Packard and Niels Mayer not be
  28. ; used in advertising or publicity pertaining to distribution of the software
  29. ; without specific, written prior permission.  Hewlett-Packard and Niels Mayer
  30. ; makes no representations about the suitability of this software for any
  31. ; purpose.  It is provided "as is" without express or implied warranty.
  32. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  33.  
  34. (defun invert-moused-widget ()
  35.   (let
  36.       ((widget (get_moused_widget))
  37.        foreground
  38.        background
  39.        )
  40.     (send widget :get_values
  41.       :XMN_FOREGROUND 'foreground
  42.       :XMN_BACKGROUND 'background
  43.       )
  44.     (send widget :set_values
  45.       :XMN_FOREGROUND background
  46.       :XMN_BACKGROUND foreground
  47.       )
  48.     ))
  49.  
  50. (invert-moused-widget)
  51.  
  52. (send (get_moused_widget) :get_values
  53.       :XMN_X nil
  54.       :XMN_Y nil
  55.       :XMN_HEIGHT nil
  56.       :XMN_WIDTH nil
  57.       )
  58.  
  59. (send (get_moused_widget) :set_values 
  60.       :xmn_font_list "6x10")
  61.  
  62. (send  (GET_MOUSED_WIDGET) :destroy)
  63.  
  64. (get_moused_widget)
  65.  
  66. (send (GET_MOUSED_WIDGET) :set_values :xmn_foreground "red")
  67. (send (GET_MOUSED_WIDGET) :set_values :xmn_foreground "white")
  68. (send (GET_MOUSED_WIDGET) :set_values :xmn_foreground "blue")
  69. (send (GET_MOUSED_WIDGET) :set_values :xmn_foreground "green")
  70. (send (GET_MOUSED_WIDGET) :set_values :xmn_background "lightgrey")
  71. (send (GET_MOUSED_WIDGET) :set_values :xmn_background "grey")
  72. (send (GET_MOUSED_WIDGET) :set_values :xmn_background "dimgrey")
  73.  
  74. (send (get_moused_widget) :set_values
  75.       :xmn_label_string (symbol-name (gensym))
  76.       )
  77.  
  78. (load "rc-shell")            ;need this for 'rc_w' below
  79. (send (get_moused_widget) :set_callback :xmn_activate_callback
  80.       '()
  81.       '((send xm_push_button_gadget_class :new :managed "quackquack" rc_w)))
  82.  
  83. (send (get_moused_widget) :set_callback :xmn_activate_callback
  84.       '(callback_reason callback_xevent)
  85.       '(
  86.     (format T "reason = ~A; event = ~A\n" callback_reason callback_xevent)
  87.     )
  88.       )
  89.  
  90.  
  91. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  92. ;; Evaluate this and click on a widget to find out information about widget.
  93. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  94. (let (
  95.       (widget (get_moused_widget))
  96.       height
  97.       width
  98.       )
  99.   (send widget :get_values
  100.       :xmn_height 'height
  101.       :xmn_width 'width
  102.       )
  103.   (format T "\tparent=~A\n\twidget=~A\n\theight=~A\n\twidth=~A\n"
  104.           (send widget :parent)
  105.           widget
  106.           height
  107.           width)
  108.   )
  109.